﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using elmah2.core.interfaces;
using elmah2.core.config;
using System.Drawing.Design;
using System.Web.Script.Services;
using elmah2.core.data;

namespace elmah2.Viewer
{
  [WebService(Namespace = "http://tempuri.org/")]
  [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  [ScriptService]
  public class Data : System.Web.Services.WebService
  {
    [WebMethod]
    public List<string> GetLoggers()
    {
      return Logger.GetLoggers().Where(R=> !R.WriteOnly).Select(R=> R.Name).ToList();
    }

    [WebMethod]
    public List<Application> GetApplications(string logger)
    {
      IErrorLogger target = Logger.GetLogger(logger);
      return target.GetApplications();
    }
  }
}
